﻿    <div style="margin:20px 0;"></div>
    <div title="修改用户" style="width:98%;padding:30px 60px;" class="" align="center">
        <form id="ff" class="easyui-form" method="post" data-options="novalidate:true">
            <div style="margin-bottom:20px">
                <input name="uname" data-options="label:'用户名:',required:true" class="easyui-textbox" style="width:100%;max-width:400px;">
            </div>
            <div style="margin-bottom:20px">
                <input name="upwd" data-options="label:'密码:'" class="easyui-textbox" style="width:100%;max-width:400px;">
            </div>
            <div style="margin-bottom:20px">
                <input name="nname" data-options="label:'昵称:'" class="easyui-textbox" style="width:100%;max-width:400px;">
            </div>
            <div style="margin-bottom:20px">
                <input name="mobile" data-options="label:'手机号码:'" value="" class="easyui-textbox" style="width:100%;max-width:400px;">
            </div>
            <div style="margin-bottom:20px">
                <input name="face" data-options="label:'头像:'" value="" class="easyui-textbox" style="width:100%;max-width:400px;">
            </div>
            <div style="margin-bottom:20px">
                <select name="admin" data-options="label:'是否为管理员:',editable:false,required:true" class="easyui-combobox" style="width:100%;max-width:400px;">
                    <option>True</option>
                    <option>False</option>
                </select>
            </div>
            <div style="margin-bottom:20px">
                <!-- 富编辑器-Begin -->
                <script src="../../ueditor/ueditor.config.js"></script>
                <script src="../../ueditor/ueditor.all.min.js"></script>
                <script src="../../ueditor/lang/zh-cn/zh-cn.js"></script>
                <script id="editor" type="text/plain" style="width:100%;height:200px;">
                </script>
                <script>
                    var ue = UE.getEditor('editor');
                </script>
                <!-- 富编辑器-End -->
            </div>
        </form>
        <div style="text-align:center;padding:5px 0">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm(1)" style="width:120px" data-options="iconCls:'icon-save'">存为草稿</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm(2)" style="width:120px" data-options="iconCls:'icon-user-edit'">修改</a>
        </div>
    </div>
    <script>
        $(function () {
            loadinfo();
        });

        //提交表单
        function submitForm(state) {
            $("#ff").form('submit', {
                //表单验证
                onsubmit: function () {
                    //处理state字段
                    $("[name=state]").val(state);
                    //表单验证
                    var checksucc = $(this).form('enableValidation').form('validate')
                    var checkeditor = UE.getEditor('editor').hasContents();
                    return checksucc && checkeditor;
                }
            });
            $.messager.alert("提示", "修改成功！");
        }

        //加载用户信息
        function loadinfo() {
            $.get("/HT/HouTai/EditLoad/@ViewContext.RouteData.Values["id"]", function (r) {
                 //显示在表单里
                $("form").form("load", r);
            });
        }
    </script>
